<?php

namespace App\Http\Controllers;

class CommonController extends ApiController
{
    /**
     * 封装获取文章列表
     * via web service 接口
     *
     * @return array
     */
    protected function getArticleList()
    {
        $page     = request('page', 1);
        $perPage  = request('per_page', 5);
        $columnId = request('column_id', 8);

        $client = MultiplexController::getWebServiceClient();

        $parameter = [
            'strOperType' => $columnId,
            'CurrentPageIndex' => $page,
            'PageSize' => $perPage,
        ];
        $data = $client->Web_GetArticleList($parameter);
        $data = $data->Web_GetArticleListResult;

        return ($data === '"-1"') ? [] : json_decode($data);
    }
}